#include "SoundPotSound.h"

const SoundPot::InstrumentType SoundPot::Sound::getType() const
{
	return type;
}

void SoundPot::Sound::setType(const SoundPot::InstrumentType& value)
{
	type = value;
}

const std::string& SoundPot::Sound::getInstrumentID() const
{
	return instrumentID;
}

void SoundPot::Sound::setInstrumentID(const std::string& value)
{
	instrumentID = value;
}

void SoundPot::Sound::assignInstrument(Instrument* instrument)
{
	assignedInstrument = instrument;

	// Keep consistency

	if(assignedInstrument && assignedInstrument->getAssignedSound() != this)
	{
		assignedInstrument->assignSound(this);
	}
}

bool SoundPot::Sound::isAssigned() const
{
	if(assignedInstrument)
	{
		return true;
	}
	else
	{
		return false;
	}
}


SoundPot::Instrument* SoundPot::Sound::getAssignedInstrument()
{
	return assignedInstrument;
}



void SoundPot::Sound::control(VstEvents* events)
{
	if(assignedInstrument)
	{
		assignedInstrument->control(events);
	}
}

void SoundPot::Sound::showEditor()
{
	if(assignedInstrument)
	{
		assignedInstrument->showEditor();
	}
}

void SoundPot::Sound::load()
{
	if(assignedInstrument)
	{
		assignedInstrument->loadAssignedSound();

		// Todo: Move into other method
		assignedInstrument->wakeUp();
	}
}